/**
 * Created by user on 2018/4/16.
 */
const HOST = {
  dev: '',
  pro: 'http://www.17baa.com'
}
const METHOD = {
  POST: 'POST',
  GET: 'GET'
}
const SET_URL = ( host ) => {
  const urls = {
    DO_LOGIN: {
      METHOD: METHOD.POST,
      URL: () => {
        return host + '/api/login'
      }
    },
    DO_UPLOAD: {
      METHOD: METHOD.POST,
      URL: () => {
        return host + '/upload'
      }
    },
    SEARCH_WEIBO: {
      METHOD: METHOD.POST,
      URL: () => {
        return host + '/api/search_weibo'
      }
    },
  }
  return urls
}

const createAPI = (debug) => {
  const host = debug ? HOST['dev'] : HOST['pro']
  return SET_URL(host)
}

export default createAPI
